#include <stdio.h>
/* 1990年1月1日 是星期一 */
void main()
{
int year, month, day, week, leap;
int sum = 0;
int i;
scanf("%d/%d/%d", &year, &month, &day);

for (i = 1990; i < year; i++)
{
    if ((i % 4 == 0 && i % 100 != 0) || i % 400 == 0)
    {
        sum += 366;
    }
    else
    {
        sum += 365;
    }
}

if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0)
{
    leap = 1;
}
else
{
    leap = 0;
}

int daysInMonth[] = {31, 28 + leap, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

for (i = 0; i < month - 1; i++)
{
    sum += daysInMonth[i];
}

sum += day;
week = sum % 7;

if (week != 0)
{
    printf("%d年%d月%d日是星期%d\n", year, month, day, week);
}
else
{
    printf("%d年%d月%d日是星期日\n", year, month, day);
}

}